package com.xsqf.jt808;

import com.xsqf.jt808.netty.server.NettyListenServer;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@EnableSwagger2
@SpringBootApplication
@ComponentScan(value = {"com.xsqf"})
@MapperScan(basePackages = {"com.xsqf.jt808.mapper"})
public class Application {

    public static void main(String[] args) throws Exception{
        int port = 9230;
        if (args.length > 0) {
            try {
                port = Integer.parseInt(args[0]);
            } catch (NumberFormatException e) {
                e.printStackTrace();
            }
        }
        ConfigurableApplicationContext context = SpringApplication.run(Application.class);
        NettyListenServer listenServer = context.getBean(NettyListenServer.class);
        listenServer.start(port);
    }

}
